//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Spreadsheet
{
    public class DateGroupItem: IOfficeXmlSerializable
    {

        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            using (ReadContext c = context.Read(xmlName))
            {
                Year = c.GetInteger("year");
                Month = c.GetOptionalInteger("month");
                Day = c.GetOptionalInteger("day");
                Hour = c.GetOptionalInteger("hour");
                Minute = c.GetOptionalInteger("minute");
                Second = c.GetOptionalInteger("second");
                DateTimeGrouping = c.GetEnum<DateTimeGrouping>("dateTimeGrouping");
            }
        }
        const string xmlName = "dateGroupItem";

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            using (WriteContext c = context.Write(xmlName))
            {
                c.SetInteger("year", Year);
                c.SetOptionalInteger("month", Month);
                c.SetOptionalInteger("day", Day);
                c.SetOptionalInteger("hour", Hour);
                c.SetOptionalInteger("minute", Minute);
                c.SetOptionalInteger("second", Second);
                c.SetEnum("dateTimeGrouping", DateTimeGrouping);
            }
        }

        #endregion
        private int _year;

        public int Year
        {
            get { return _year; }
            set { _year = value; }
        }
        private int? _month;

        public int? Month
        {
            get { return _month; }
            set { _month = value; }
        }
        private int? _day;

        public int? Day
        {
            get { return _day; }
            set { _day = value; }
        }
        private int? _hour;

        public int? Hour
        {
            get { return _hour; }
            set { _hour = value; }
        }
        private int? _minute;

        public int? Minute
        {
            get { return _minute; }
            set { _minute = value; }
        }
        private int? _second;

        public int? Second
        {
            get { return _second; }
            set { _second = value; }
        }
        private DateTimeGrouping _dateTimeGrouping;

        public DateTimeGrouping DateTimeGrouping
        {
            get { return _dateTimeGrouping; }
            set { _dateTimeGrouping = value; }
        }
	
	
	
	
	
	
	
    }
}
